package cn.wolfcode.wolf2w.web.controller;

import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.service.IBannerService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("index")
public class IndexController {
    @Autowired
    private IBannerService bannerService;

    /**
     * 通过游记类型查询游记信息
     * @return
     */
    @GetMapping("banners/travel")
    public Object queryTravel(){

        List<Banner> list = bannerService.queryByTravel(Banner.TYPE_TRAVEL);
        return JsonResult.success(list);
    }

    /**
     * 通过攻略类型查询攻略明细信息
     * @return
     */
    @GetMapping("banners/strategy")
    public Object queryStrategy(){

        List<Banner> list = bannerService.queryByStrategy(Banner.TYPE_STRATEGY);
        return JsonResult.success(list);
    }
}
